# Importing Data
POLAND <- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Steel/TSA.xlsx",sheet = "Sheet1", range = "Z1:Z239")

# Checking the Imported Data
View(POLAND)
# Creating Time Series Data
POLAND_ts <- ts(POLAND, start=c(2000,1), end=c(2019,09), frequency=12)
# Viewing and Checking the Created Time Series Data
POLAND_ts
sum(is.na(POLAND_ts))
library(forecast)
POLAND_ts <- tsclean(POLAND_ts)
POLAND_ts

# Identification: Plotting the Time Series Data
plot(POLAND_ts)

# Estimating the appropriate model
POLAND_ts_model <- auto.arima(POLAND_ts)
POLAND_ts_model

# Forecasting
options(max.print=1000000)
POLAND_ts_forecast <- forecast (POLAND_ts_model, level=c(95), h=255)
plot(POLAND_ts_forecast)
POLAND_ts_forecast             

# Exporting
write.table(POLAND_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Steel/POLAND_TSA.csv", sep=",")
